import type { Wallet } from '../../../types/Wallet'
import { getInjectedConnector, hasInjectedProvider } from '../../getInjectedConnector'
import { phantomWalletIcon } from './phantomWalletIcon'

export const phantomWallet = (): Wallet => {
  return {
    id: 'phantom',
    name: 'Phantom',
    rdns: 'app.phantom',
    iconUrl: phantomWalletIcon,
    iconBackground: '#9A8AEE',
    installed: hasInjectedProvider({ namespace: 'phantom.ethereum' }),
    downloadUrls: {
      chrome: 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',
      firefox: 'https://addons.mozilla.org/firefox/addon/phantom-app/',
      browserExtension: 'https://phantom.app/download'
    },
    extension: {
      instructions: {
        steps: [
          {
            description: 'We recommend pinning Phantom to your taskbar for easier access to your wallet.',
            step: 'install',
            title: 'Install the Phantom extension'
          },
          {
            description:
              'Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone.',
            step: 'create',
            title: 'Create or Import a Wallet'
          },
          {
            description: 'Once you set up your wallet, click below to refresh the browser and load up the extension.',
            step: 'refresh',
            title: 'Refresh your browser'
          }
        ],
        learnMoreUrl: 'https://help.phantom.app'
      }
    },
    createConnector: getInjectedConnector({
      namespace: 'phantom.ethereum'
    })
  }
}
